package day2;

import java.util.Scanner;
//https://www.nowcoder.com/questionTerminal/8869d99cf1264e60a6d9eff4295e5bab
public class code1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        char[] ch = str.toCharArray();
        reverse(ch,0,str.length()-1);
        int i = 0;
        int j = i;
        while (j < str.length()) {
            j = i;
            while(j < str.length() && ch[j] != ' ') {
                j++;
            }
            reverse(ch,i,j-1);
            if(j < str.length()) {
                i = j + 1;
            }else {
                System.out.println(ch);
            }
        }
    }

    public static void reverse(char[] arr,int start,int end) {
        while (start < end) {
            char temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
            start++;
            end--;
        }
    }
}
